<include file="Public/min-header" />
<link href="__PUBLIC__/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/plugins/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<div class="wrapper">
    <include file="Public/breadcrumb"/>
	<section class="content">
		<style>
			/* th{text-align: center;font-size: 16px;background:#4c88ab;color: #fff;line-height:32px;height: 32px;} */
		</style>
       <div class="row">
       		<div class="col-xs-12">
	       		<div class="box">
	             <div class="box-header">
	             <div class="row">
  					<div class="col-md-10">
  						<form action="" method="get" class="navbar-form form-inline">
		  					<div class="col-xs-7" style="width:540px;padding:0px;">
								<?php
								if(session('fenbu_id')==0){
								?>
								<div class="input-group margin" style="float:left;margin-right:10px">
								 <select name="fenbu_id" id="fenbu_id" class="input-sm" style="width:120px;height:33px;line-height:33px;">
									 <option value="">全部</option>
									<foreach name="fenbu_list" item="v">
									   <option value="{$v['fenbu_id']}" <?php if(I('fenbu_id')==$v['fenbu_id']){ ?> selected="selected" <?php } ?>>
										{$v['fenbu_name']}
									   </option>
									</foreach>
								</select>
								</div>
								<?php
								}else{
									echo '<input type="hidden" name="fenbu_id" id="fenbu_id" value="'.session('fenbu_id').'" />';
								}
								?>
			                    <div class="input-group margin" style="width: 380px;">
			                      <div class="input-group-addon">
			                          出库时间<i class="fa fa-calendar"></i>
			                      </div>
			                         <input type="text" id="start_time" value="{$timegap}" autocomplete="off" name="timegap" class="form-control pull-right">
			                    </div>
			                    
			                    <div class="input-group">
			                      
			                         <input type="text" id="goods_name"  value="{:I('goods_name')}" placeholder="请输入商品名称" autocomplete="off" name="goods_name" class="form-control pull-right">
			                    </div>
			                    <button type="button" class="btn btn-default pull-right" id="daochu"><i class="fa fa-file-excel-o"></i>&nbsp;导出excel</button>
	  						</div>	
                   		 	<div class="col-xs-1"><input class="btn btn-primary margin" type="submit" value="确定"></div>
                  		 </form>
                 	</div>
		  		 </div>
	             </div><!-- /.box-header -->
	             <div class="box-body">
	           	 <div class="row">
	            	<div class="col-sm-12">
		              <table id="list-table" class="table table-bordered table-striped dataTable" role="grid" aria-describedby="example1_info">
		                 <thead>
		                   <tr role="row">
			                   
                               <th class="sorting" tabindex="0" aria-controls="example1" style="width: 80px;">排行</th>
			                   <th class="sorting" tabindex="0" aria-controls="example1" style="width: 460px;">商品名称</th>
			                   <th class="sorting" tabindex="0" aria-controls="example1" >货号</th>
							   <th class="sorting" tabindex="0" aria-controls="example1" >所属店铺</th>
			                   <th class="sorting" tabindex="0" aria-controls="example1" >销售量</th>
			                   <th class="sorting" tabindex="0" aria-controls="example1" >销售额</th>
		                  	   <th class="sorting" tabindex="0" aria-controls="example1" >均价</th>
		                   </tr>
		                 </thead>
						<tbody>
                         <foreach name="list" item="vo" key="k" >
                          <tr role="row" align="center">
                             <td>{$k+1}</td>
                             <td>{$vo.goods_name}</td>
		                     <td>{$vo.goods_sn}</td>
							 <td style="color: #deb029;">{$vo.store_name}</td>
		                     <td>{$vo.sale_num}</td>		                    
		                     <td>{$vo.sale_amount}</td>
		                     <td>{$vo['sale_amount']/$vo.sale_num|round=###,2}</td>
		                   </tr>
		                  </foreach>
		                   </tbody>
		                 <tfoot>
		                 </tfoot>
		               </table>
	               </div>
	          </div>
              <div class="row">
              	    <div class="col-sm-6 text-left"></div>
                    <div class="col-sm-6 text-right">{$page}</div>		
              </div>
	          </div>
	        </div>
       	</div>
       </div>
   </section>
</div>
<script type="text/javascript">
$(document).ready(function() {
		$('#start_time').daterangepicker({
			format:"YYYY-MM-DD HH:mm:ss",
			singleDatePicker: false,
			showDropdowns: true,
			minDate:'2020-01-01 00:00:00',
			maxDate:'2030-01-01 00:00:00',
			startDate:'{:date("Y-m-d")} 00:00:00',
	        showWeekNumbers: true,
	        timePicker: true,
	        timePickerIncrement: 1,
	        timePicker12Hour: false,
	        opens: 'right',
	        buttonClasses: ['btn btn-default'],
	        applyClass: 'btn-small btn-primary',
	        cancelClass: 'btn-small',
		    locale : {
	            applyLabel : '确定',
	            cancelLabel : '取消',
	            fromLabel : '起始时间',
	            toLabel : '结束时间',
	            customRangeLabel : '自定义',
	            daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],
	            monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月','七月', '八月', '九月', '十月', '十一月', '十二月' ],
	            firstDay : 1
	        }
		});
	
});
$("#daochu").click(function(){
		var start_time=$("#start_time").val();
		var goods_name=$("#goods_name").val();
		location.href="/index.php/Admin/Report/exportSaleTops?timegap="+start_time+"&goods_name="+goods_name;
	})
</script>
</body>
</html>